package com.attilax.rest;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse;

import com.attilax.web.responseImp;


//com.attilax.rest.CrossDomainFilter
//@   //WebFilter(filterName="CrossDomainFilter1",urlPatterns="/*")  
 
public class CrossDomainFilter implements Filter {

	@Override
	public void destroy() {
		 
	}

	@Override
	public void doFilter(ServletRequest req, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletResponse res=(HttpServletResponse) response;
		res.setHeader("Access-Control-Allow-Origin", "*");
		//"Access-Control-Allow-Methods:POST,GET"
		 chain.doFilter(req, response);
		System.out.println("--CrossDomainFilter exeed");
		
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		 
	//	return this;
	}

}
